import request from '@/config/axios'

export interface RepairOrderVO {
  id: string
  businessCode: string
  procId: string
  status: string
  name: string
  repairStatus: string
  categoryTplId: string
  repairType: string
  urgencyId: string
  reportOrgId: string
  planFinishDate: localdate
  reportUserId: string
  repairCost: number
  content: string
  pictureId: string
  originatorId: string
  businessDate: localdate
  autoAct: string
  autoActRule: string
  assetId: string
}

// 查询故障申请单分页
export const getRepairOrderPage = async (params) => {
  return await request.get({ url: `/eam/repair-order/page`, params })
}

// 资产报修待办
export const RepairOrderTodoPage = async (params) => {
  return await request.get({ url: `/eam/repair-order/todoPage`, params })
}

// 资产报修已办
export const RepairOrderDonePage = async (params) => {
  return await request.get({ url: `/eam/repair-order/donePage`, params })
}

// 查询故障申请单详情
export const getRepairOrder = async (id: number) => {
  return await request.get({ url: `/eam/repair-order/get?id=` + id })
}

// 新增故障申请单
export const createRepairOrder = async (data: any) => {
  return await request.post({ url: `/eam/repair-order/create`, data })
}

// 修改故障申请单
export const updateRepairOrder = async (data: any) => {
  return await request.put({ url: `/eam/repair-order/update`, data })
}

// 修改故障申请单 流程
export const completeRepairOrder = async (data: any) => {
  return await request.post({ url: `/eam/repair-order/complete`, data })
}

// 删除故障申请单
export const deleteRepairOrder = async (id: number) => {
  return await request.delete({ url: `/eam/repair-order/delete?id=` + id })
}

// 导出故障申请单 Excel
export const exportRepairOrder = async (params) => {
  return await request.download({ url: `/eam/repair-order/export-excel`, params })
}
